﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using ENTITY;

namespace MODELS
{
    public class MOD_MonHoc
    {
        private dbConnect obj_conn;
        public MOD_MonHoc()
        {
            obj_conn = new dbConnect();
        }

        public DataTable GetDaTaSelectAll()
        {
            return obj_conn.GetData("Mon_SelectAll", null);
        }

        public int Insert(EN_MonHoc obj_en)
        { 
            SqlParameter[] para = {
                                    new SqlParameter("MaMon",obj_en.MaMon),
                                    new SqlParameter("TenMon",obj_en.TenMon)
                                  };
            return obj_conn.ExecuteSQL("Mon_Insert", para);
        }

        public int Update(EN_MonHoc obj_en)
        {
            SqlParameter[] para ={
                                    new SqlParameter("MaMon",obj_en.MaMon),
                                    new SqlParameter("TenMon",obj_en.TenMon)
                                };
            return obj_conn.ExecuteSQL("Mon_Update", para);
        }

        public int Delete(EN_MonHoc obj_en)
        {
            SqlParameter[] para = { 
                                    new SqlParameter("MaMon",obj_en.MaMon)
                                  };
            return obj_conn.ExecuteSQL("Mon_Delete", para);
        }
    }
}
